use proc_macro::TokenStream;


mod periph;
mod periph2;

/**
 * 
 * #[derive(Gpio)]
   #[config(name = "PB3", mode = "IN_DOWN")]
 */
#[proc_macro_derive(Gpio, attributes(io_config))]
pub fn derive_gpio(input: TokenStream) -> TokenStream {
    periph::gpio::build(input)
}

#[proc_macro_derive(GpioGroup, attributes(ios_config))]
pub fn derive_gpio_group(input: TokenStream) -> TokenStream {
    periph::gpio_group::build(input)
}

#[proc_macro_derive(DmaInit, attributes(dma_config))]
pub fn derive_dma(input: TokenStream) -> TokenStream {
    periph::dma::build(input)
}

#[proc_macro_derive(DmaInit2, attributes(dma_config2))]
pub fn derive_dma2(input: TokenStream) -> TokenStream {
    periph::dma2::build(input)
}

#[proc_macro_derive(AdcInit, attributes(adc_config))]
pub fn derive_adc(input: TokenStream) -> TokenStream {
    periph::adc::build(input)
}

#[proc_macro_derive(UartInit, attributes(uart_config))]
pub fn derive_uart(input: TokenStream) -> TokenStream {
    periph::uart::build(input)
}

#[proc_macro_derive(GpioConfig, attributes(gpio))]
pub fn derive_gpio2(input: TokenStream) -> TokenStream {
    periph2::gpio::build(input)
}

#[proc_macro_derive(DmaConfig, attributes(dma))]
pub fn derive_dma_2(input: TokenStream) -> TokenStream {
    periph2::dma::build(input)
}

#[proc_macro_derive(PeriphReg, attributes(periph))]
pub fn derive_reg(input: TokenStream) -> TokenStream {
    periph2::reg_build(input)
}

#[proc_macro_derive(TimDelay, attributes(delay))]
pub fn derive_tim_delay(input: TokenStream) -> TokenStream {
    periph2::time_delay::build(input)
}

#[proc_macro_derive(TimPwm, attributes(pwm))]
pub fn derive_tim_pwm(input: TokenStream) -> TokenStream {
    periph2::tim_pwm::build(input)
}

#[proc_macro_derive(TimPwm2, attributes(pwm))]
pub fn derive_tim_pwm2(input: TokenStream) -> TokenStream {
    periph2::tim_pwm2::build(input)
}

#[proc_macro_derive(SpiConfig, attributes(spi))]
pub fn derive_spi(input: TokenStream) -> TokenStream {
    periph2::spi::build(input)
}

#[proc_macro_derive(CanConfig, attributes(can))]
pub fn derive_can(input: TokenStream) -> TokenStream {
    periph2::can::build(input)
}

#[proc_macro_derive(UartConfig, attributes(uart))]
pub fn derive_uart2(input: TokenStream) -> TokenStream {
    periph2::uart::build(input)
}

